package com.sqtracker.recommender.repository;

import com.sqtracker.recommender.model.TorrentMetadataExt;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;
import java.util.Optional;

@Repository
public interface TorrentMetadataExtRepository extends MongoRepository<TorrentMetadataExt, String> {

    Optional<TorrentMetadataExt> findByTorrentId(String torrentId);

    List<TorrentMetadataExt> findByLanguage(String language);

    List<TorrentMetadataExt> findByTagsContaining(String tag);

    List<TorrentMetadataExt> findByLastUpdatedGreaterThan(Date date);

    List<TorrentMetadataExt> findByLastUpdatedGreaterThan(Date date, Sort sort);

    List<TorrentMetadataExt> findByTorrentCategoryId(String categoryId);

    List<TorrentMetadataExt> findByTorrentCategoryId(String categoryId, Sort sort);

    List<TorrentMetadataExt> findByQuality(String quality);
}